import { useCookies } from '@vueuse/integrations/useCookies'


// 设置token的key值
const TokenKey = 'admin-token'

// 创建对象
const cookies = useCookies()


// 设置cookies
export function setToken(token){
    // 并且设置过期时间为7天
    cookies.set(TokenKey,token,{expires: new Date(Date.now() + 7 * 24 * 3600 * 1000)})
}


// 获取cookies
export function getToken(){
    return cookies.get(TokenKey)
}


// 删除cookies(退出登录的时候去掉标签页的cookie和token)
export function removeToken(){
    cookies.remove(TokenKey)
    cookies.remove('tabList')
}


